package mt.client;

import java.util.ArrayList;

import mt.Order;

public class OrderResume {


	private ArrayList<Order> orders;

	public OrderResume( ){
		super();
		this.orders = new ArrayList<Order>();
		start();

	}
	
	public ArrayList<Order> getOrders() {
		return orders;
	}

	public void setOrders(ArrayList<Order> orders) {
		this.orders = orders;
	}
	
	public ArrayList<Order> getBuyOrders(){
		ArrayList<Order> buyOrders = new ArrayList<Order> ();
		for(Order order : this.orders){
			if(order.isBuyOrder()){
				buyOrders.add(order);
			}
			
		}
		return buyOrders;
	}
	
	public ArrayList<Order> getSellOrders(){
		ArrayList<Order> sellOrders = new ArrayList<Order> ();
		for(Order order : this.orders){
			if(order.isSellOrder()){
				sellOrders.add(order);
			}
			
		}
		return sellOrders;
	}


	public void start(){
	      Order sellOrder1 =Order.createSellOrder("EDP", "stock1", 10, 100.00);        
	        Order sellOrder2 =Order.createSellOrder("EDP", "stock2", 10, 200.00);
	        Order sellOrder3 =Order.createSellOrder("GALP", "stock3", 10, 300.00);
	        Order sellOrder4 =Order.createSellOrder("BRISA", "stock4", 10, 400.00);
        
	        orders.add(sellOrder1);
	        orders.add(sellOrder2);
	        orders.add(sellOrder3);
	        orders.add(sellOrder4);
	}
	@Override
	public String toString() {
		return "OrderResume [orders=" + orders + "]";
	}
	
	


}
